package com.shujia.day10;

public class Code02StringAndStringBuffer {
    public static void main(String[] args) {
        // String作为参数传递
        // StringBuffer作为参数传递
        String a  ="hello";
        String b = "world";
        concatString(a,b);
        System.out.println(a); // hello

        StringBuffer sb1 = new StringBuffer("hello");
        StringBuffer sb2 = new StringBuffer("world");
        concatBuffer(sb1,sb2);
        System.out.println(sb1); // helloworld

    }

    public static void concatString(String a,String b){

        a += b;
        System.out.println(a);
        System.out.println(b);
    }

    public static void concatBuffer(StringBuffer a, StringBuffer b){
        a.append(b);
        System.out.println(a);
        System.out.println(b);
    }
}
